package com.bz.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.bz.common.ResponseDto;
import com.bz.entity.ContactsCustomerEntity;
import com.bz.model.ContactsDto;
import com.bz.service.IContactsService;

@RestController
@RequestMapping(value = "/api/contacts")
public class ContactsController {

    @Autowired
    private IContactsService contactsService;

    @RequestMapping(value = "/info")
    public ContactsDto info() {
        return contactsService.get();
    }

    @PostMapping(value = "/add")
    public ResponseDto<String> add(@Validated @RequestBody ContactsCustomerEntity data) {
        contactsService.addContactsCustomer(data);
        return new ResponseDto<String>();
    }

}
